<?php 
App::uses('AppController', 'Controller');

class ShopDetailController extends AppController {
	
	public function index($category_id) {
		$this->loadModel('Shop');
		// Empty or null return shop page
		// Not number or less than 1 then return shop page
		if(empty($category_id) || intval($category_id) < 1){
			$this->set('empty',"Không có gian hàng nào!");
		}

		$conditions = array('category_id' => $category_id, "deleted"=>0);
		// Get information all shops with category_id
		$this->paginate = array(
                                'limit' => ITEM_PER_PAGE_USER,
                                'order' => array('Shop.updated_at' => 'desc'),
                             );
      
        $data = $this->paginate("Shop", $conditions);
		
		if(empty($data)){
			$this->set('empty',"Không có gian hàng nào!");
		}
        $this->set("data", $data);
        $this->set('title_for_layout', 'Chi tiết gian hàng');
	}	
}
?>